﻿if exists (select name from sysobjects where name = 'vHourlyReport' and type = 'V')
drop View vHourlyReport

Go

USE [NPMonitor]
GO

CREATE VIEW [vHourlyReport]
AS
SELECT BeginTime,avg(time) AS AverageTime,LocationId,ScenarioNO
FROM (
		SELECT  PoolId AS LocationId, ScenarioNO, BeginTimeFormat
		AS BeginTime,Time FROM  dbo.HttpActions 
	) AS T WHERE T.ScenarioNO != ''
GROUP BY BeginTime,LocationId,ScenarioNO;









GO
